/*
 * Copyright (c) Extreme Vision Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ASCEND_COMMON_H
#define ASCEND_COMMON_H

#include <map>
#include "evdeploy/runtime/ascend/atlas_base.h"

namespace ev
{

    class AscendModel : public EVBaseAscendModel, public EVAscendModel
    {
    public:
        AscendModel();

        ~AscendModel();
        // init model and infos
        EVStatus Init(const char *net, void **config) override;

        EVStatus UnInit() override;
        // run inference
        EVStatus Infer(EVModelData *in, EVModelData *out) override;

        EVStatus SetIO(const std::vector<std::string> &inputs, const std::vector<std::string> &outputs) override;

        EVStatus OptimizeModel(const char *model_name) override;

    private:
        aclmdlDataset *m_input_dataset;
        std::vector<int> m_input_sizes;
        std::vector<aclmdlIODims> m_input_dims;
        std::vector<void *> m_input_buffers;
        std::vector<aclDataBuffer *> m_input_data_buffers;

        aclmdlDataset *m_output_dataset;
        std::vector<int> m_output_sizes;
        std::vector<aclmdlIODims> m_output_dims;
        std::vector<void *> m_output_buffers;
        std::vector<aclDataBuffer *> m_output_data_buffers;
        std::vector<void *> m_output_buffers_host;
    };

} // namespace ev

#endif
